Date.prototype.Format = function (fmt) { //author: meizz
    var o = {
        "M+": this.getMonth() + 1,
        "d+": this.getDate(),
        "h+": this.getHours(),
        "m+": this.getMinutes(),
        "s+": this.getSeconds(),
        "q+": Math.floor((this.getMonth() + 3) / 3),
        "S": this.getMilliseconds()
    };
    if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
    for (var k in o)
        if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
    return fmt;
};

function getDate(dateDuration){
    var today = new Date();
    var someDay = new Date();
    var endTime = today;//用于http请求"2016-01-01"
    var startTime;
    var endTimeCn = today; //用于页面展示"5月3日""2016/05/01"等
    var startTimeCn;
    var endTimeShort = today;//用于http请求"20160101"
    var startTimeShort;

    if(dateDuration == "7day"){
        someDay.setDate(someDay.getDate()-7);
        startTime = someDay.Format("yyyy-MM-dd");
        startTimeCn = someDay.Format("MM月dd日");
        startTimeShort = someDay.Format("yyyyMMdd");
        endTimeCn = endTime.Format("MM月dd日");
        endTimeShort = endTime.Format("yyyyMMdd");
    }else if(dateDuration == "2week"){
        someDay.setDate(someDay.getDate()-14);
        startTime = someDay.Format("yyyy-MM-dd");
        startTimeCn = someDay.Format("MM月dd日");
        startTimeShort = someDay.Format("yyyyMMdd");
        endTimeCn = endTime.Format("MM月dd日");
        endTimeShort = endTime.Format("yyyyMMdd");
    }else if(dateDuration == "30day"){
        someDay.setDate(someDay.getDate()-30);
        startTime = someDay.Format("yyyy-MM-dd");
        startTimeCn = someDay.Format("MM月dd日");
        startTimeShort = someDay.Format("yyyyMMdd");
        endTimeCn = endTime.Format("MM月dd日");
        endTimeShort = endTime.Format("yyyyMMdd");
    }else if(dateDuration == "1month"){
        someDay.setMonth(someDay.getMonth()-1);
        startTime = someDay.Format("yyyy-MM-01");
        startTimeCn = someDay.Format("MM月01日");
        startTimeShort = someDay.Format("yyyyMM01");
        endTimeCn = endTime.Format("MM月dd日");
        endTimeShort = endTime.Format("yyyyMMdd");
    }else if(dateDuration == "3month"){
        someDay.setMonth(someDay.getMonth()-3);
        startTime = someDay.Format("yyyy-MM-01");
        startTimeCn = someDay.Format("yyyy/MM/01");
        startTimeShort = someDay.Format("yyyyMM01");
        endTimeCn = endTime.Format("yyyy/MM/dd");
        endTimeShort = endTime.Format("yyyyMMdd");
    }else if(dateDuration == "12month"){
        someDay.setMonth(someDay.getMonth()-12);
        startTime = someDay.Format("yyyy-MM-01");
        startTimeCn = someDay.Format("yyyy/MM/01");
        startTimeShort = someDay.Format("yyyyMM01");
        endTimeCn = endTime.Format("yyyy/MM/dd");
        endTimeShort = endTime.Format("yyyyMMdd");
    }else if(dateDuration == "today"){
        someDay.setDate(someDay.getDate());
        startTime = endTime.Format("yyyy-MM-dd");
        startTimeCn = endTime.Format("MM月dd日");
        startTimeShort = someDay.Format("yyyyMMdd");
        endTimeCn = startTimeCn;
        endTimeShort = startTimeShort;
        endTime = someDay;
    }else if(dateDuration == "yesterday"){
        someDay.setDate(someDay.getDate()-1);
        startTime = someDay.Format("yyyy-MM-dd");
        startTimeCn = someDay.Format("MM月dd日");
        startTimeShort = someDay.Format("yyyyMMdd");
        endTimeCn = startTimeCn;
        endTimeShort = startTimeShort;
        endTime = someDay;
    }
    endTime = endTime.Format("yyyy-MM-dd");
    return [startTime, endTime, startTimeCn, endTimeCn, startTimeShort, endTimeShort];
}